const path = require("path");
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
    mode:"development",
    entry:"./src/main.js",//入口文件
    output:{ //输出文件
        filename:"bundle.js",
        path:path.resolve(__dirname,"dist")
    },
    module:{
        rules:[
            //css解析并加载到dom
            {
                test:/\.css$/i,
                use:["style-loader","css-loader"],
                exclude:/node_modules/
            },
            //less加载并转换成css
            //需要less less-loader
            {
                test:/\.less$/i,
                use:["style-loader","css-loader","less-loader"],
                exclude:/node_modules/
            }
        ]
    },
    plugins:[
        new HtmlWebpackPlugin({
            template:"./src/index.html",
            filename:"index.html"
        })
    ]
    
    
}